﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style TargetType="{x:Type Control}" x:Key="BaseStyle">
        <Setter Property="FontSize" Value="12" />
        <Setter Property="FontFamily" Value="Arial" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
    </Style>

    <Style TargetType="{x:Type Control}" x:Key="ValidateStyle" BasedOn="{StaticResource BaseStyle}">
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <WrapPanel>
                        <AdornedElementPlaceholder Name="Control_AdornedElementPlaceholder"/>
                        <TextBlock Foreground="Red" FontSize="16" FontWeight="Bold" Margin="3,0,3,0" Text="!" 
                                   ToolTip="{Binding ElementName=Control_AdornedElementPlaceholder, Path=AdornedElement.(Validation.Errors).CurrentItem.ErrorContent}"/>
                    </WrapPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true" >
                <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
                <Setter Property="BorderThickness" Value="1" />
                <Setter Property="BorderBrush" Value="Red" />
                <Setter Property="Margin" Value="0 0 3 0" />
                <!-- -->
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type Button}" BasedOn="{StaticResource BaseStyle}">
        <Setter Property="Height" Value="23" />
        <Setter Property="MinWidth" Value="75" />
        <Setter Property="Margin" Value="10" />
    </Style>

    <Style TargetType="{x:Type TextBox}" x:Key="TextBoxStyle" BasedOn="{StaticResource ValidateStyle}">
        <Setter Property="Height" Value="25" />
    </Style>

</ResourceDictionary>